﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:vue3D="clr-namespace:myBoard.Framework">
  
  <!-- RotatingContentControl -->
  <Style TargetType="{x:Type vue3D:RotatingContentControl}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type vue3D:RotatingContentControl}">
          <Grid>
            <Grid x:Name="_contentGrid">
              <ContentPresenter x:Name="ContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" />
            </Grid>
            <Viewport3D x:Name="Viewport3D">
              <Viewport3D.Camera>
                <PerspectiveCamera x:Name="_camera" FieldOfView="30" LookDirection="0,0,-1" UpDirection="0,1,0">
                  <PerspectiveCamera.Transform>
                    <RotateTransform3D>
                      <RotateTransform3D.Rotation>
                        <QuaternionRotation3D x:Name="_quaternionRotation3D">
                        </QuaternionRotation3D>
                      </RotateTransform3D.Rotation>
                    </RotateTransform3D>
                  </PerspectiveCamera.Transform>
                </PerspectiveCamera>
              </Viewport3D.Camera>
              <ModelVisual3D x:Name="ModelVisual3D">
                <ModelVisual3D.Transform>
                  <Transform3DGroup>
                    <Transform3DGroup.Children>
                      <Transform3DCollection>
                        <ScaleTransform3D ScaleX="1" ScaleY="1"  ScaleZ="1" x:Name="_scaleTransformModelRatio" />
                      </Transform3DCollection>
                    </Transform3DGroup.Children>
                  </Transform3DGroup>
                </ModelVisual3D.Transform>
                <ModelVisual3D.Content>
                  <GeometryModel3D x:Name="GeometryModel3D" >
                    <GeometryModel3D.Geometry>
                      <MeshGeometry3D x:Name="MeshGeometry3D" 
                                      TriangleIndices="0,1,2,0,2,3"
                                      Positions="-1,1,0 -1,-1,0 1,-1,0 1,1,0"
                                      Normals="0,0,1 0,0,1 0,0,1 0,0,1"
                                      TextureCoordinates="0,0 0,1 1,1 1,0">
                      </MeshGeometry3D>
                    </GeometryModel3D.Geometry>
                    <!--<GeometryModel3D.Material>                      
                      <DiffuseMaterial>
                        <DiffuseMaterial.Brush>
                          --><!--<VisualBrush Visual="{Binding ElementName=ContentPresenter}"/>--><!--
                        </DiffuseMaterial.Brush>
                      </DiffuseMaterial>                      
                    </GeometryModel3D.Material>-->
                  </GeometryModel3D>
                </ModelVisual3D.Content>
              </ModelVisual3D>
              <ModelVisual3D x:Name="AmbientContainer">
                <ModelVisual3D.Content>
                  <AmbientLight x:Name="Ambient" Color="#FF808080"/>
                </ModelVisual3D.Content>
              </ModelVisual3D>
              <ModelVisual3D x:Name="DirectionalContainer">
                <ModelVisual3D.Content>
                  <DirectionalLight x:Name="Directional" Color="#FF7F7F7F" Direction="0,0,-1">
                    <DirectionalLight.Transform>
                      <TranslateTransform3D OffsetX="0" OffsetY="0" OffsetZ="3"/>
                    </DirectionalLight.Transform>
                  </DirectionalLight>
                </ModelVisual3D.Content>
              </ModelVisual3D>
            </Viewport3D>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  

</ResourceDictionary>
